<?php

if (!defined('BASEPATH'))
	exit('No direct script access allowed');
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of week
 *
 * @author b4by
 */
class cron extends MY_Controller {

	function __construct() {
		parent::__construct();
		$this->load->model('model_image');
		$this->load->model('model_user');
		if (!$this->isRootAdmin() && $_SERVER['REMOTE_ADDR'] != '123.30.189.158') {
			show_error(lang('not_authentication'));
		}
		if (!ini_get('date.timezone'))
			date_default_timezone_set('GMT');
	}

	public function index() {
		
	}

	public function week() {
		$this->model_user->update_weeklikes();
		echo 'success';
		file_put_contents('week.txt', 'Last run: ' . date('h:s d/m/Y'));
	}

	public function month() {
		$this->model_user->update_monthlikes();
		file_put_contents('month.txt', 'Last run: ' . date('h:s d/m/Y'));
		echo 'success';
	}

}

?>
